﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

using System.Web.UI;

namespace CorreoSocialWeb.Views
{
    public class ReturnUrlHelper
    {
        private static string SessionKey = "ReturnUrl";

        public static void Redireccionar(Page page)
        {
            page.Response.Redirect( (string) page.Session[SessionKey]);
        }

        public static string GetUrl(Page page)
        { 
            return (string) page.Session[SessionKey];
        }

        public static void Guardar(Page page)
        {
            if (page.Request.UrlReferrer == null)
                return;

            page.Session[SessionKey] = page.Request.UrlReferrer.ToString();
        }

        public static void Guardar(Page page, string url)
        {
            page.Session[SessionKey] = url;
        }
    }
}